/*********************************************************************************
 *      Copyright:  (C) 2025 iot25<lingyun@email.com>
 *                  All rights reserved.
 *
 *       Filename:  get_time.c
 *    Description:  This file get_time 
 *                 
 *        Version:  1.0.0(30/04/25)
 *         Author:  iot25 <lingyun@email.com>
 *      ChangeLog:  1, Release initial version on "30/04/25 23:25:52"
 *                 
 ********************************************************************************/
#include<stdio.h>
#include<time.h>
#include<string.h>
#include<errno.h>
#include"get_time.h"
#include"logger.h"

int get_time(char *time_now, size_t size)
{
	char				time_str[256];
	struct tm			*local_time;
	time_t				now_time;

	now_time = time(NULL);
	local_time = localtime(&now_time);
	strftime(time_str, sizeof(time_str), "%Y-%m-%d %H:%M:%S", local_time);
	strncpy(time_now, time_str, size-1);
	time_now[size-1] = '\0';
	return 0;
}

